package com.zw.pm.module.integrate.interactive;

import com.zw.pm.base.BaseController;
import com.zw.pm.common.JsonResult;
import com.zw.pm.gen.entity.Project;
import com.zw.pm.module.board.multi.MultiModel;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @Description: 互动专区 控制层
 *
 * @Author: China.sgl
 * @Date: 2019/9/16 09:11
 */
@Controller
@RequestMapping("/integrate/interactive")
public class InteractiveController extends BaseController {

    @Autowired
    private InteractiveService interactiveService;

    /**
     * 页面
     * 
     * @return 页面路径
     */
    @GetMapping
    @RequiresPermissions({"integrate:interactive"})
    public String project() {
        return "integrate/interactive/page";
    }

    /**
     * 项目列表
     * 
     * @param messageModel 查询条件
     * @return list
     */
    @ResponseBody
    @PostMapping("/list")
    @RequiresPermissions({"integrate:interactive"})
    public JsonResult list(MessageModel messageModel) {
        startPage();
        List<Project> list = interactiveService.findProject(messageModel);
        return jsonResult(list);
    }

    /**
     * 消息列表
     *
     * @param id 项目ID
     * @return list
     */
    @ResponseBody
    @PostMapping("/message")
    @RequiresPermissions({"integrate:interactive"})
    public List<MessageModel> message(Integer id) {
        return interactiveService.findMessageByProjectId(id);
    }

}
